<?php

namespace App\Http\Controllers\Test;
use App\Facades\TestFacde;
use App\Http\Controllers\Controller;
use App\Testtest;
use Illuminate\Support\Facades\DB;
use think\Collection;
use think\facade\Cache;

class TestController extends Controller
{
    public function index()
    {
       /*$creat = Testtest::query()->create([
          'name' => 'dddd',
       ]);
       dd($creat);*/
        /*$res = Testtest::all();
       dd($res->toArray());*/
       $test =  Testtest::query()->find(3);
        $test->name = 'names';
        $test->save();
       dd($test);
       return '';
    }

    public function conllection()
    {
        $test =  Testtest::all();
       //$test->pluck('name')->dump();
        //$test->take(2)->dump();
        //$test->where('id',2)->dump();
        $test->each(function ($v){

            dd($v);
        });
    }
    public function cache()
    {
        \Illuminate\Support\Facades\Cache::put('ceshile',1);
    }

    public function facade()
    {
        return TestFacde::getProductById(234);
    }
}
